const testArrayTs:string | number | any[] = [
  1,2,[11,12],3,[13,[14,15]]
]

const flatArrayTs = (arr:any[]):any[] => {
  const isDeep:boolean = arr.some(item => item instanceof Array)
  if (!isDeep) {
    return arr
  }
  const res:any[] = Array.prototype.concat.apply([], arr)
  return flatArrayTs(res)
}

console.log(flatArrayTs(testArrayTs))
